class TrainRouter < ActiveRecord::Base
  belongs_to :train
  belongs_to :router

  def self.findPageByTrainId(offset, limit ,trainId)
    find(:all,
      :offset     => offset,
      :limit      => limit,
      :conditions => ['train_id = ?', trainId],
      :order      => 'sequence')
  end

  def self.findByTrainIdAndSequence trainId,sequence
    find(
      :first,
      :conditions => ['sequence = ? AND train_id = ? ',sequence,trainId]
    )
  end

end
